//
// Created by LiuYou on 2021/5/17.
//

#include "UserInfo.hpp"

#include <utility>

ClientEntry::UserInfo::UserInfo() = default;

ClientEntry::UserInfo::UserInfo(std::string name, std::string passwd) : name(std::move(name)),
                                                                        passwd(std::move(passwd)) {}

const std::string& ClientEntry::UserInfo::getName() const {
    return name;
}

void ClientEntry::UserInfo::setName(const std::string& name) {
    UserInfo::name = name;
}

const std::string& ClientEntry::UserInfo::getPasswd() const {
    return passwd;
}

void ClientEntry::UserInfo::setPasswd(const std::string& passwd) {
    UserInfo::passwd = passwd;
}

std::ostream& ClientEntry::operator<<(std::ostream& os, const ClientEntry::UserInfo& info) {
    os << "name: " << info.name << " passwd: " << info.passwd;
    return os;
}

bool ClientEntry::operator==(const ClientEntry::UserInfo& lhs, const ClientEntry::UserInfo& rhs) {
    return lhs.name == rhs.name &&
           lhs.passwd == rhs.passwd;
}

bool ClientEntry::operator!=(const ClientEntry::UserInfo& lhs, const ClientEntry::UserInfo& rhs) {
    return !(rhs == lhs);
}

ClientEntry::UserInfo::~UserInfo() = default;

ClientEntry::Users::Users() {
    this->users.reserve(6);
}
